public class Main {
    public static int solution(int n, int[] u) {
        assert n == u.length;
        int min = Integer.MAX_VALUE;
        for (int num : u) {
            if (num < min) {
                min = num;
            }
        }
        int count = 0;
        for (int num : u) {
            if (num == min) {
                count++;
            }
        }
        return n - count;
    }

    public static void main(String[] args) {
        System.out.println(solution(5, new int[]{1, 2, 3, 1, 2}) == 3);
        System.out.println(solution(4, new int[]{100000, 100000, 100000, 100000}) == 0);
        System.out.println(solution(6, new int[]{1, 1, 1, 2, 2, 2}) == 3);
    }
}
